//
//  MZYoutubeViewController.m
//  Mehfile Zainab
//
//  Created by Badourali Azad on 05/12/2013.
//  Copyright (c) 2013 Azad Badourali. All rights reserved.
//

#import "MZYoutubeViewController.h"

@interface MZYoutubeViewController ()

@end

@implementation MZYoutubeViewController

@synthesize youtubeWebView;
@synthesize webIndicator;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    NSString *fullURL = @"http://www.youtube.com/user/mehfilezainab";
    NSURL *url = [NSURL URLWithString:fullURL];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [self.youtubeWebView loadRequest:requestObj];
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    NSLog(@"********************* MEMORY WARNING *********************");
}

- (void)webViewDidStartLoad:(UIWebView *)webView {
    NSLog(@"Start loading youtube chanel");
    [webIndicator startAnimating];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    NSLog(@"End loading youtube chanel");
    [webIndicator stopAnimating];
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
    NSLog(@"Fail while loading youtube chanel");
    [webIndicator stopAnimating];    
}

- (void)dealloc
{
    NSLog(@"Call to dealloc");
    [youtubeWebView release];
    [super dealloc];
}

@end
